import React, { Component } from "react";
import PropTypes from "prop-types";
import { Form, Input } from "antd";
const Item = Form.Item;

class Updateform extends Component {
  static propTypes = {
    categoryName: PropTypes.string.isRequired,
    setForm: PropTypes.func.isRequired,
  };
  componentWillMount() {
    this.props.setForm(this.props.form);
  }
  constructor(props) {
    super(props);
    this.state = {};
  }
  render() {
    const { categoryName } = this.props;
    const { getFieldDecorator } = this.props.form; // 获取表单实例
    return (
      <>
        <Form onSubmit={this.handleSubmit} className="login-form">
          <Item>
            {getFieldDecorator("categoryName", {
              initialValue: categoryName,
              rules: [{ required: true, message: "名字必须" }],
            })(<Input placeholder="请输入分类名称" />)}
          </Item>
        </Form>
      </>
    );
  }
}

export default Form.create()(Updateform);
